package com.jigang.study.eureka.client.consumer.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Consumer Controller
 *
 * @author wujigang
 * @date 2022-05-01 23:49
 **/
@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("info")
    public String info() {
        ResponseEntity<String> result = restTemplate.getForEntity("http://eureka-provider/provider/info", String.class);
        return "consumer: " + result.getBody();
    }
}
